<template>
		<view class="list">
			<view v-for="item in newslist" :key="item.id">
				<image v-if="item.pic" :src="formatImg(item.pic, 'orj360')" :alt="item.title" @click="goJump(item)" />
				<view class="info">
					<text  @click="goJump(item)">{{item.title}}</text>
					<view class="tag">&nbsp;</view>
					<view>
						<text class="share">
							<text class="iconfont">&#xe655;</i>分享
						</text>
						<text @click="goJumpCate(item)">
							分类：{{item.name}}
						</text>
						<text>时间：{{item.addtime}}</text>
					</view>
				</view>
			</view>
	</view>
</template>

<script>
import { formatPic } from '@/utils';
export default {
	props: ['newslist'],
	methods: {
		onJump(item) {
			uni.navigateTo({
				url: `/article/${item.id}`
			})
		},
		goJumpCate(item) {
			uni.navigateTo({
				url: `/news/${this.reNewsCateName(item.cid)}`
			})
		},
		formatImg(pic) {
			return formatPic(pic)
		},
		CateName(id) {
			let name;
			switch (id) {
				case 211:
					name = 'zixun';
					break;
				case 206:
					name = 'donghua';
					break;
				case 205:
					name = 'manhua';
					break;
				case 207:
					name = 'cast';
					break;
				case 208:
					name = 'bagua';
					break;
				case 221:
					name = 'jianping';
					break;
				case 212:
					name = 'pic';
					break;
				case 222:
					name = 'video';
					break;
				case 214:
					name = 'yugao';
					break;
				case 215:
					name = 'op';
					break;
				case 216:
					name = 'bgm';
					break;
				case 217:
					name = 'ed';
					break;
				case 223:
					name = 'cm';
					break;
				case 213:
					name = 'cosplay';
					break;
				case 220:
					name = 'mad';
					break;
				case 218:
					name = 'shengrou';
					break;
				case 219:
					name = 'tedian';
					break;
				case 209:
					name = 'chanye';
					break;
				default:
					name = 'news';
					break;
			}
			return name;
		}
	}
};
</script>

<style></style>
